package com.cskaoyan.controller;

import com.cskaoyan.bean.BaseRespVo;
import com.cskaoyan.bean.MarketFootprint;
import com.cskaoyan.bean.collection.AppletFootprintListVO;
import com.cskaoyan.bean.param.BaseParam;
import com.cskaoyan.service.FootprintService;
import com.cskaoyan.util.AuthUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpSession;

/**
 * 创建日期: 2022/05/07 14:17
 *
 * @author liutao
 */

@RestController
public class AppletFootprintController {

    @Autowired
    FootprintService footprintService;

    @RequestMapping("wx/footprint/list")
    public BaseRespVo footprintList(BaseParam baseParam) {
        // 假设用户id=1
        // Integer id = 1;

        Integer id = AuthUtils.getUserId();
        AppletFootprintListVO appletFootprintListVO = footprintService.footprintList(baseParam, id);
        return BaseRespVo.ok(appletFootprintListVO);
    }

    @RequestMapping("wx/footprint/delete")
    public BaseRespVo footprintDelete(@RequestBody MarketFootprint marketFootprint) {
        // 逻辑删除
        marketFootprint.setDeleted(true);
        footprintService.footprintDelete(marketFootprint);
        return BaseRespVo.ok(null);
    }
}
